<template>
  <view class="app-me">
	  <u-navbar :is-back="false" title="我的"
	    title-size="30"
	    :background="{background:'#2B88FE' }"
	    title-color="#fff">
	    <div class="head_icon">
	      <u-icon @click="$api.handleBackTo"
	        name="arrow-left" color="#fff"
	        size="36">
	      </u-icon>
	      <u-icon @click="$api.handleHomeTo"
	        name="home" color="#fff" size="36">
	      </u-icon>
	    </div>
	  </u-navbar>
	  
    <app-userHead :user="user">
    </app-userHead>
    <view class="me-conent">
      <u-cell-group>
        <navigator
          url="/pages/sale/changePassword">
          <u-cell-item icon="setting-fill"
            title="修改密码">
          </u-cell-item>
        </navigator>
        <navigator url="/pages/message/message"
          open-type="switchTab"
          hover-class="className">
          <u-cell-item icon="more-circle-fill"
            title="我的消息">
            <u-badge :count="message>0?'new':0"
              :absolute="false" slot="right-icon">
            </u-badge>
          </u-cell-item>
        </navigator>
        <!-- <u-cell-item icon="volume-fill" title="系统通知">
          <u-badge :count="notification" :is-dot="true" :absolute="false" slot="right-icon">
          </u-badge>
        </u-cell-item> -->
        <navigator url="/pages/sale/user_log">
          <u-cell-item icon="bell-fill"
            title="操作日志">
          </u-cell-item>
        </navigator>
        <!-- <u-cell-item icon="bookmark-fill" title="内容推送" :arrow="false">
          <u-switch slot="right-icon" v-model="delivery"></u-switch>
        </u-cell-item> -->
      </u-cell-group>
    </view>
    <view class="me-footer">
      <u-button type="primary" @click="outLogin">
        退出登录
      </u-button>
    </view>
  </view>
</template>

<script>
import appUserHead from '@/components/app-userHead'
export default {
  components: {
    appUserHead
  },
  data() {
    return {
      user: null,
      focus: 99,
      message: 0,
      notification: 1,
      delivery: true
    }
  },
  onShareAppMessage() {},
  mounted() {
    let user = uni.getStorageSync('user_info')
    this.user = user
    this.message = user.iMessCount
  },
  methods: {
    handleCell(index) {
      console.log('🚀 ~ file: me.vue ~ line 60 ~ handleCell ~ index', index)
    },
    outLogin() {
      uni.showToast({
        title: '退出登录成功',
        duration: 1000
      })
      setTimeout(() => {
        uni.removeStorageSync('user_info')
        uni.redirectTo({
          url: '/pages/index/login'
        })
      }, 1000)
    }
  }
}
</script>

<style lang="scss" scoped>
.me-conent {
  margin-top: 20rpx;
}
.me-footer {
  margin: 20rpx;
  position: fixed;
  bottom: 2%;
  width: 94%;
}
</style>